package com.llbnk.log;

import com.alibaba.fastjson.JSON;

import javax.servlet.http.HttpServletRequest;

/**
 * 日志生成器
 * @author llbnk
 * @create 2022-12-06 20:21
 */

public class LogGenerator {

    //专门用来打日志方法
    //HttpServletRequest 主要用于取到远程客户端ip，请求头，cookie等等
    public static String getLog(HttpServletRequest request,
                              String userId,String action,Object info){
        return JSON.toJSONString(new LogObject(action,userId,request.getRemoteAddr(),info));
    }
}
